package com.lishe.lishe.lishe.module.excitation.presenter;

import com.lishe.lishe.lishe.common.Globals;
import com.lishe.lishe.lishe.module.excitation.bean.GiveLikeBannerResponse;
import com.lishe.lishe.lishe.module.excitation.bean.GiveLikeMessageResponse;
import com.lishe.lishe.lishe.module.excitation.bean.GiveLikeWallListResponse;
import com.lishe.lishe.net.BaseHttpLoader;
import com.lishe.lishe.net.BaseProtocal;
import com.lishe.lishe.net.NetAPI;
import com.lishe.lishe.net.ResultListener;

import io.reactivex.Observable;
import okhttp3.ResponseBody;

/**
 * 标    题：
 * 功能描述：
 * 作    者：zouxx
 * 创建时间：2018/8/17
 */

public class GiveLikeWallModule {

    public void getBannerList(String token, ResultListener listener) {
        BaseHttpLoader http = new BaseHttpLoader(GiveLikeBannerResponse.class, Globals.LISHE_URL) {
            @Override
            public Observable<ResponseBody> structureObservable(NetAPI api) {
                return api.getExcitionBanner(token);
            }
        };
        http.executor(listener);
    }

    public void getGiveLikeList(String token, int page, int pageSize, String sign, ResultListener listener) {
        BaseHttpLoader http = new BaseHttpLoader(GiveLikeWallListResponse.class, Globals.LISHE_URL_EXCITATION) {
            @Override
            public Observable<ResponseBody> structureObservable(NetAPI api) {
                return api.getGiveLikeList(token, sign, page, pageSize);
            }
        };
        http.executor(listener);
    }

    public void getMessageList(String token, String sign, ResultListener listener) {
        BaseHttpLoader http = new BaseHttpLoader(GiveLikeMessageResponse.class, Globals.LISHE_URL_EXCITATION) {
            @Override
            public Observable<ResponseBody> structureObservable(NetAPI api) {
                return api.getMessageList(token, sign);
            }
        };
        http.executor(listener);
    }

    public void cancelHitEvent(String token, String eventId, String sign, ResultListener listener) {
        BaseHttpLoader http = new BaseHttpLoader(BaseProtocal.class, Globals.LISHE_URL_EXCITATION) {
            @Override
            public Observable<ResponseBody> structureObservable(NetAPI api) {
                return api.cancelHitEvent(token, sign, eventId);
            }
        };
        http.executor(listener);
    }
    public void hitEvent(String token, String eventId, String sign, ResultListener listener) {
        BaseHttpLoader http = new BaseHttpLoader(BaseProtocal.class, Globals.LISHE_URL_EXCITATION) {
            @Override
            public Observable<ResponseBody> structureObservable(NetAPI api) {
                return api.hitEvent(token, sign, eventId);
            }
        };
        http.executor(listener);
    }

}
